package model

import (
	"gorm.io/gorm"
	"zk/zg3_zk1/src/pro/global"
)

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:varchar(20);unique;comment:'手机号'"`
	Password string `gorm:"type:char(32);comment:'密码'"`
}

func (u *User) GetUserByMobile(mobile string) error {
	return global.DB.Where("mobile=?", mobile).Limit(1).Find(&u).Error
}

type UserFollow struct {
	gorm.Model
	UserId       int64 //用户ID
	DistId       int64 //好友ID
	DistNickName string
}

func (uf *UserFollow) GetUfByUserId(userId int64) error {
	return global.DB.Where("user_id=?", userId).Find(&uf).Error
}
